/**
 * User information reducer
 *
 */
import * as types from '../action/ActionType';

const initialState = {
  step: {
  	approach: null,
  	concentrate: null,
  	concentrateNotice: null,
  	event: null,
  	flowBaseInfo: {
  		flowProcesses: []
  	},
  	planInfoRes: null,
  	preparation: null,
  	review: null
  },
  equipment: [],
  flowId: '',
  roles: []
};

export default function userReducer(state = initialState, action) {
  switch (action.type) {
    case types.SAVE_DATA : 
      return Object.assign({},
          state, {
            step: action.data
          });
    case types.SAVE_EQUIPMENT :
      return Object.assign({},
          state, {
            equipment: action.equipment
          });
    case types.SAVE_FLOWID :
      return Object.assign({},
          state, {
            flowId: action.flowId
          });
    case types.SAVE_ROLES :
      return Object.assign({},
        state, {
          roles: action.roles
        });
    default :
      return state;
  }
}
